<?

class Store_model extends Model {

    function Store_model()
    {
        parent::Model();
    }


	function get_price($id){
	
          global $dollar;
                   
          $price_min = $this->db->query("SELECT MIN(price) as price from articles where father='$id' and price !=0 and available =1");
          $price_max = $this->db->query("SELECT MAX(price) as price from articles where father='$id' and available =1");
          
          $row_price_min = $price_min->row();
          $row_price_max = $price_max->row();
          $price_min = $row_price_min->price;
          $price_max = $row_price_max->price;
                        
          $price_min = $price_min * $dollar;
          $price_max = $price_max * $dollar;

                        
          if($price_min == $price_max && $price_max != 0){
	       	$price_min = number_format($price_min, 0, ',', ' ');
			return ($price_min);
          }else{
           	$price_min = number_format($price_min, 0, ',', ' ');
           	$price_max = number_format($price_max, 0, ',', ' ');
           	$price = "$price_min" . "—" . "$price_max";
           	return ($price);
          }
	
	}


}







?>